Skip to content

fix(smus): Look for profile in both config and credentials files when adding region to profile#8522

Merged
laileni-aws merged 3 commits intoaws:masterfrom
kzr-at-amazon:master
Jan 28, 2026
Merged

fix(smus): Look for profile in both config and credentials files when adding region to profile#8522
laileni-aws merged 3 commits intoaws:masterfrom
kzr-at-amazon:master

Conversation

@kzr-at-amazon
Copy link
Contributor

Problem

  • If a user picks a profile that does not have region entry from the config file, smus tries to update the profile with selected region. But smus is only looking for the profile in credentials file.

Solution

  • Look for profile in both config and credentials files when adding region to profile
  • Use shared parsing method to handle profiles with profile prefix

Test

Updating profile with profile prefix in config file

before

[profile configWithProfilePrefix]
AWS_ACCESS_KEY_ID=xyz        
AWS_SECRET_ACCESS_KEY=xyz              
AWS_SESSION_TOKEN=xyz

after

[profile configWithProfilePrefix]
AWS_ACCESS_KEY_ID=xyz        
AWS_SECRET_ACCESS_KEY=xyz              
AWS_SESSION_TOKEN=xyz
region = ap-east-1

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@kzr-at-amazon kzr-at-amazon requested a review from a team as a code owner January 22, 2026 00:40
@github-actions
Copy link

  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

continue
}

const content = await fs.readFileText(filePath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit : we are reading file twice here and one for sections. I think it can be done in one fileread call
content = await fs.readFileText(filePath) and then
sections = parseIni(content, vscode.Uri.file(filePath))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will fix it.

const content = await fs.readFileText(filePath)

// Find the profile section boundaries using the startLines from parsed section
const profileStartLine = profileSection.startLines[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can startLines be empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No while profile section exists.


// Find the profile section boundaries using the startLines from parsed section
const profileStartLine = profileSection.startLines[0]
const lines = content.split('\n')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tested this in Windows as well? I believe worth testing

Copy link
Contributor Author

@kzr-at-amazon kzr-at-amazon Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will make it os eol instead.

@kzr-at-amazon kzr-at-amazon force-pushed the master branch 2 times, most recently from 4ec2713 to 38e97e6 Compare January 22, 2026 22:58
@laileni-aws laileni-aws merged commit 8b4d088 into aws:master Jan 28, 2026
64 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants